Microsoft® SQL Server 2008 R2 Unleashed by Ray Rankins & Paul Bertucci & Chris Gallelli & Alex T. Silverstein

Microsoft® SQL Server 2008 R2 Unleashed by Ray Rankins & Paul Bertucci & Chris Gallelli & Alex T. Silverstein

Author:Ray Rankins & Paul Bertucci & Chris Gallelli & Alex T. Silverstein
Language: eng
Format: epub
Publisher: Sams
Published: 2011-06-14T16:00:00+00:00


Explicitly adding additional columns to nonclustered indexes to promote the occurrence of index covering has historically been a common method of improving query response time. Consider the following query:

If you create an index on only the price column, SQL Server can find the rows in the index where price is between $10 and $20, but it has to access the data rows to retrieve royalty. With 100 rows in the range, the worst-case I/O cost to retrieve the data rows would be as follows:

Number of index levels

+ Number of index pages to find the 100 matching rows

+ (100 × Number of pages per lookup via the row locator)

If the royalty column were added to the index on the price column, SQL Server could scan the index to retrieve the results instead of having to perform the lookups via the row locator against the table, resulting in faster query response. The I/O cost using index covering would be lower, as follows:

Number of index levels

+ Number of index pages to scan to find the 100 matching rows

If you are considering padding your indexes to take advantage of index covering, beware of making an index too wide. As index row width approaches data row width, the benefits of covering are lost as the number of pages in the leaf level increases. As the number of leaf-level index pages approaches the number of pages in the table, the number of index levels also increases, increasing the I/O cost of using the index to locate data.

You should also avoid adding to the index columns that are frequently updated. Remember that any changes to the columns in the data rows cascade into the indexes as well. This increases the index maintenance overhead, which can adversely affect update performance.

As an alternative to adding columns to the nonclustered index key to encourage index covering, you might want to consider taking advantage of the included columns feature in SQL Server 2008.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Popular ebooks
Whisky: Malt Whiskies of Scotland (Collins Little Books) by dominic roskrow(56028)
What's Done in Darkness by Kayla Perrin(26593)
The Fifty Shades Trilogy & Grey by E L James(19079)
Shot Through the Heart: DI Grace Fisher 2 by Isabelle Grey(19058)
Shot Through the Heart by Mercy Celeste(18936)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 10 by Isuna Hasekura and Jyuu Ayakura(17112)
Python GUI Applications using PyQt5 : The hands-on guide to build apps with Python by Verdugo Leire(16994)
Peren F. Statistics for Business and Economics...Essential Formulas 3ed 2025 by Unknown(16878)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 03 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16825)
Wolf & Parchment: New Theory Spice & Wolf, Vol. 01 by Isuna Hasekura and Jyuu Ayakura & Jyuu Ayakura(16447)
The Subtle Art of Not Giving a F*ck by Mark Manson(14353)
The 3rd Cycle of the Betrayed Series Collection: Extremely Controversial Historical Thrillers (Betrayed Series Boxed set) by McCray Carolyn(14140)
Stepbrother Stories 2 - 21 Taboo Story Collection (Brother Sister Stepbrother Stepsister Taboo Pseudo Incest Family Virgin Creampie Pregnant Forced Pregnancy Breeding) by Roxi Harding(13645)
Scorched Earth by Nick Kyme(12771)
Drei Generationen auf dem Jakobsweg by Stein Pia(10965)
Suna by Ziefle Pia(10889)
Scythe by Neal Shusterman(10337)
International Relations from the Global South; Worlds of Difference; First Edition by Arlene B. Tickner & Karen Smith(9522)
The Ultimate Python Exercise Book: 700 Practical Exercises for Beginners with Quiz Questions by Copy(9495)
D:\Jan\FTP\HOL\Work\Alien Breed - Tower Assault CD32 Alien Breed II - The Horror Continues Manual 1.jpg by PDFCreator(9480)